﻿// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Actor/BaseWeapon.h"
#include "BaseCharacter.generated.h"

UCLASS()
class COMBAT_GAME_CPP_API ABaseCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ABaseCharacter();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

	//**************************************************** 通用抽象方法
	// 攻击动画
	virtual void PlayAttackMontage();
	
	//	是否正在攻击 用于判断ai行为树执行完成攻击task
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	bool IsAttacking_AI = false;
	
	// 动画驱动真实攻击
	virtual void AttackDamage();
	

	// 受伤
	virtual void TakeHitDamage(const float DamageValue);

	//	伤害响应
	virtual void HurtResponse();
	//	死亡响应
	virtual void DeathResponse();
	//	死亡响应
	virtual void DeathClear();


	//**************************************************** 通用方法

	//设置运动模式
	void SetMovementMode(EMovementMode MovementMode);

	// 播放蒙太奇
	void PlayMontage(UAnimMontage* AnimMontage);

	//改变weapon的挂点位置
	void ChangeWeaponAnimSocketName(ABaseWeapon* Weapon, FName AnimSocketName);

	UFUNCTION(BlueprintCallable)
	float GetHealthProgress();

	//**************************************************** 通用属性
	UPROPERTY(EditAnywhere)
	float Health = 100.0f;

	float MaxHealth = 100.0f;

	UPROPERTY(EditAnywhere)
	float AttackRadius = 20.0f;

	UPROPERTY(EditAnywhere)
	UAnimMontage* HurtAnimation;

	// 是否死亡 用于动画蓝图状态切换判断
	UPROPERTY(BlueprintReadWrite, EditAnywhere)
	bool IsDeath_Anim = false;
};
